package view.component.monster.large_monster
{
	import enums.main.UISize;
	
	import feathers.controls.Label;
	import feathers.data.ListCollection;
	
	import model.vo.monster.LMonsterCollectVo;
	
	import view.component.BaseSCListView;
	import view.render.monster.LMonsterCollectListItem;
	
	
	/**
	 * 大型怪物详细-剥取掉落界面
	 * @author £iang
	 * 
	 */	
	public class LMDetailCollectView extends BaseSCListView
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 次数标题 */
		public var timesTitle:Label;
		/** 下位标题 */
		public var lowTitle:Label;
		/** 上位标题 */
		public var highTitle:Label;
		/** 条件 标题 */
		public var conditionTitle:Label;
		
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 * 初始化函数 
		 * 
		 */		
		override protected function initialize():void
		{ 
			_itemH = UISize.LMONSTER_COLLECT_ITEM_H * this.dpiScale;
			_listH = UISize.MAIN_H - 
				( UISize.MONSTER_TAB_AREA_H + 
					UISize.LMONSTER_DETAIL_TAB_AREA_H +
					UISize.LIST_TITLE_H) * this.dpiScale;
			_scrollerMaxPage = 2;
			_firstName = "部位";
			super.initialize();
		}
		
		
		override protected function initializeOther():void
		{
			super.initializeOther();
			timesTitle = new Label();
			timesTitle.text = "次数";
			timesTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( timesTitle );
			
			lowTitle = new Label();
			lowTitle.text = "下位";
			lowTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( lowTitle );
			
			highTitle = new Label();
			highTitle.text = "上位";
			highTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( highTitle );
			
			conditionTitle = new Label();
			conditionTitle.text = "条件";
			conditionTitle.textRendererProperties.wordWrap = true;
			scollerContainer.addChild( conditionTitle );
			
		}
		
		
		/**
		 * 绘制函数 
		 * 
		 */		
		override protected function draw():void
		{
			var labelY:Number = ( UISize.LIST_TITLE_H - 
				43 ) / 2 * this.dpiScale;
			var leftPadding:Number = UISize.TITLE_PADDING_LEFT * this.dpiScale;
			var firstTitleFullW:Number;
			
			firstTitle.y = labelY;
			firstTitle.x = leftPadding;
			firstTitleFullW = UISize.MAIN_W / 4;
			firstTitle.width = firstTitleFullW - leftPadding;
			
			scollerContainer.x = firstTitleFullW;
			scollerContainer.width = UISize.MAIN_W - firstTitleFullW;
			scollerContainer.height = UISize.LIST_TITLE_H;
			
			timesTitle.y = labelY;
			timesTitle.x = 0;
			timesTitle.width  = UISize.MAIN_W * 0.15;
			
			lowTitle.y = labelY;
			lowTitle.x = UISize.MAIN_W * 0.15;
			lowTitle.width  = UISize.MAIN_W * 0.6;
			
			highTitle.y = labelY;
			highTitle.x = UISize.MAIN_W * 0.75;
			highTitle.width  = UISize.MAIN_W * 0.75;
			
			conditionTitle.y = labelY;
			conditionTitle.x = UISize.MAIN_W * 1.5;
			conditionTitle.width  = UISize.MAIN_W * 0.75;
			
			var buttonY:Number = ( UISize.LIST_TITLE_H * this.dpiScale - leftButton.height ) / 2;
			
			leftButton.x = firstTitleFullW - leftButton.width;
			leftButton.y = buttonY;
			
			rightButton.x = UISize.MAIN_W - leftButton.width;
			rightButton.y = buttonY;
			
			list.y = UISize.LIST_TITLE_H * this.dpiScale;
		}
		
		/**
		 * 设置列表数据 
		 * @param dataVec 数据
		 * 
		 */		
		public function setListData( dataVec:Vector.<LMonsterCollectVo> ):void
		{
			var i:int;
			var len:int = dataVec.length;
			
			_listData = new ListCollection([]);
			
			for( i = 0; i < len; i++)
			{
				var item:LMonsterCollectListItem = new LMonsterCollectListItem();
				var tmpData:LMonsterCollectVo = dataVec[ i ] as LMonsterCollectVo;
				
				item.setData( tmpData );
				_listData.push( { item:item, itemData:tmpData } );
			}
			
			list.dataProvider = _listData;
			
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构函数 
		 * 
		 */		
		protected override function disposeAnythingInContainer():void
		{
			disposeLabels( [
				"times", "low", "high",
				"condition"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function LMDetailCollectView()
		{
			super();
		}
	}
}